<template>
  <div class="full flex-col" style="height: 80vh;">
    <div class="flex-col center-center">
      <div class="title_naire">{{ data.title }}</div>
    </div>
    <div class="flex_1" style="margin: 16px; overflow-y: auto">
      <div style="margin-top: 16px;"
           v-for="(item,i) in data.listQt">
        <div class="flex-col">
          <span class="qtTitle">{{ item.index }}: {{ item.title }} ({{ item.qtTypeStr }}  {{ item.score }}分)</span>
          <div v-if="item.qtType== QtType_Single ||item.qtType==QtType_TrueFalse">
            <div class="flex-col" style="margin-top: 8px;  " v-for="item_item in item.listItemInfo">
              <div class="flex-row-center">
                <el-radio class="option">{{ item_item.content }}</el-radio>
              </div>
            </div>
          </div>
          <div v-if="item.qtType== QtType_Multi">
            <div class="flex-col" style="margin-top: 8px;" v-for="item_item in item.listItemInfo">
              <div class="flex-row-center">
                <el-checkbox class="option">{{ item_item.content }}</el-checkbox>
              </div>
            </div>
          </div>
        </div>
        <div v-if="i!=data.listQt.length-1" class="comm_split_h"></div>
      </div>
    </div>
    <div class="flex-col w_full">
      <el-button type="primary" :icon="CircleClose" @click="click_ok">结束预览</el-button>
    </div>
  </div>
</template>


<script setup lang="ts">
import {reactive} from "vue";
import {QtBankVO} from "@/type/vo/QtBankVO";
import {QtType_Multi, QtType_Single, QtType_TrueFalse} from "@/constants/Constants_QtType";
import {CircleClose} from "@element-plus/icons-vue";
import {useRoute} from "vue-router";

const route = useRoute();
console.log(route);


const props = defineProps({
  title: {
    type: String,
    default: '',
  },
  listQtInNaire: {
    type: Array as () => QtBankVO[],
    default: () => [],
  },
});

const emit = defineEmits(["close"])

const title = props.title as string;
const listQt = props.listQtInNaire as Array<QtBankVO>;

const data = reactive({
      // qbId: props.qbId || "",
      title: title,
      listQt: listQt,
    }
);

const click_ok = () => {
  emit("close", true);
}


</script>

<style scoped>
.item .el-form-item__label {
  font-size: 14px;
  font-weight: 400;
  color: #7D8592;
  line-height: 24px;
}

.title_naire {
  font-size: 24px;
  font-weight: 600;
  color: #0A1629;
  line-height: 28px;
}
</style>